define(function(require, exports, module) {
    require("nicescroll");

    var template = require("template");

    var render = template.compile(require("text!./main.html"));

    exports.init = function (data) {
        var html = render(data);
        $(".main-sidebar .sidebar .sidebar-menu").append(html);

        $(".sidebar").niceScroll({
            cursorcolor:"#d2d6de",
            autohidemode: true,
            cursorborderradius: "0px" // 滚动条圆角（像素）
        });

        //菜单点击后重新渲染菜单滚动条
        $(".sidebar-menu").click(function(){
            $(".sidebar").getNiceScroll().resize();
            $(".sidebar").niceScroll({
                cursorcolor:"#d2d6de",
                autohidemode: true,
                cursorborderradius: "0px" // 滚动条圆角（像素）
            });
        });
    }
});